<template>
	<div>
		<el-button type="text" size="mini" @click="funcGetQr">
			{{ title }}<i style="color:#409EFF;" class="el-icon-info"></i>
		</el-button>
	</div>
</template>

<script>
	export default {
		props: {
			title: {
				type: String,
				default: () => {
					return '查看位置'
				}
			},
			lng: {
				type: String,
				default: () => {
					return ''
				}
			},
			type: {
				type: String,
				default: () => {
					return '0'
				}
			},
			lat: {
				type: String,
				default: () => {
					return ''
				}
			},
			lng_b: {
				type: String,
				default: () => {
					return ''
				}
			},
			lat_b: {
				type: String,
				default: () => {
					return ''
				}
			},
			x: {
				type: String,
				default: () => {
					return ''
				}
			}
		},
		data() {
			let page_data = {}
			//
			return page_data
		},
		watch: {
			lng(new_val, old_val) {
			},
			lat(new_val, old_val) {
			}
		},
		created() {
		},
		methods: {
			////////////////////////////////////
			//预览图片
			funcGetQr() {
				let path = `pages/app_car/car_detail/car_detail?l=${this.lng},${this.lat}`
				if (this.lng_b != '' && this.lat_b != '') {
					path = `pages/app_car/car_detail/car_detail?l=${this.lng},${this.lat}|${this.lng_b},${this.lat_b}`
				}
				path = `${path}&type=${this.type}`

				let url = `${BASE_API}/app/z_common/app_api/wxapp_qr_long?path=${encodeURIComponent(path)}&x=${this.x}`
				let content = `坐标：${this.lng},${this.lat}`
				if (this.lng_b != '' && this.lat_b != '') {
					content += `、${this.lng_b},${this.lat_b}`
				}
				content += `<br/><a href="${url}" target="_blank"><img src="${url}" style="width: 100%;" /></a>`
				this.$confirm(content, '扫码查看位置', {
					dangerouslyUseHTMLString: true,
					showCancelButton: false,
					showConfirmButton: false,
					showClose: true
				}).catch(() => {

				})
			}
			////////////////////////////////////
			////////////////////////////////////
		}
	}
</script>
